<template>
  <div class="member-home">
    <!-- 概览 -->
    <HomeOverview />
    <HomePanelCollect title="我的收藏">
      <GoodsItem v-for="item in collectGoods" :key="item.id" :goods="item" />
    </HomePanelCollect>
    <HomePanelFoot title="我的足迹">
      <GoodsItem v-for="item in footMarks" :key="item.id" :goods="item" />
    </HomePanelFoot>
    <!-- 猜你喜欢 -->
    <GoodsRelevant/>
  </div>
</template>

<script>
import HomeOverview from './components/home-overview.vue'
import HomePanelCollect from './components/home-panel-collect.vue'
import HomePanelFoot from './components/home-panel-foot.vue'
import GoodsRelevant from '@/views/goods/components/goods-relevant.vue'
import GoodsItem from '@/views/category/components/goods-item.vue'
import { findCollect, findFootMarks } from '@/api/member'
import { ref } from 'vue'
export default {
  name: 'MemberHomePage',
  components: {
    HomeOverview,
    HomePanelCollect,
    HomePanelFoot,
    GoodsRelevant,
    GoodsItem
  },
  setup () {
    // const goodsFootmark = {
    //   id: 1,
    //   name: '自煮火锅不排队 麦饭石不粘鸳鸯火锅',
    //   picture: 'https://yanxuan-item.nosdn.127.net/fcdcb840a0f5dd754bb8fd2157579012.jpg',
    //   desc: '清汤鲜香 红汤劲爽',
    //   price: '159.00'
    // }
    // 调用模拟接口
    // request('/my/test', 'get').then(data => {
    //   console.log(data)
    // })
    const collectGoods = ref([])
    findCollect({
      page: 1,
      pageSize: 4
    }).then(data => {
      collectGoods.value = data.result.items
    })
    const footMarks = ref([])
    findFootMarks({
      page: 1,
      pageSize: 4
    }).then(data => {
      footMarks.value = data.result.items
    })
    return { footMarks, collectGoods }
  }
}
</script>

<style lang="less" scoped>
:deep(.xtx-carousel) .carousel-btn.prev {
  left: 5px;
}
:deep(.xtx-carousel) .carousel-btn.next {
  right: 5px;
}
</style>
